<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 计算属性，计算属性名
      const name = "user" + "name";
      const person = {
        firstName: "jack",
        [name]: "li",
        get fullName() {
          return `${this.lastName} ${this.firstName}`;
        },
        set fullName(value) {
          [this.lastName, this.firstName] = value.split(" ");
        },
      };
      console.log(person.fullName); // jack li

      person.fullName = "lili zhang"; // setfullName(lili zhang)
      console.log(person.fullName); // lili zhang
    </script>
  </body>
</html>
